# coding:utf-8
from typing import List


# 双指针
class Solution:
    # 寻找俩值*index之差最大
    def maxArea(self, height: List[int]) -> int:
        area = 0
        i = 0
        j = len(height)-1
        while i < j:
            area = max(area, (j-i)*(min(height[i], height[j])))
            # 保留较高的那个
            if height[i] > height[j]:
                j = j-1
            else:
                i = i+1
        return area


if __name__ == "__main__":
    solu = Solution()
    print(solu.maxArea([1, 8, 6, 2, 5, 4, 8, 3, 7]))
